//
// Created by Administrator on 2016/8/31.
//

#ifndef PROJECT_MODEL_H
#define PROJECT_MODEL_H

#include "EntityObject.h"

namespace ZainGL {
    class Model : public EntityObject {
    private:
        Model();

    public:
        std::string mPath;
        std::vector<Model *> mModels;

        Model(const char *path, bool bCombineMesh, GLuint maxInstanceNum, std::unordered_map<std::string, ZainTL::FileDatas> *bufferMap);

    private:
        void processNode(aiNode *pNode, const aiScene *pScene, glm::mat4 parentAbsoluteTrans, bool bCombine, GLuint maxInstanceNum, std::unordered_map<std::string, ZainTL::FileDatas> *bufferMap);

    public:
        static glm::mat4 aiMatrix4x4ToGlm(const aiMatrix4x4 &pT);

        virtual void draw(std::vector<glm::mat4> *const instanceTransforms= nullptr) override;

        virtual void renderToShadowMap(std::vector<glm::mat4> *const instanceTransforms = nullptr) override;

        void bindDataGL(GLuint i);
    };
}


#endif //PROJECT_MODEL_H
